package com.modifiertech.lineage.skills;

import com.feed_the_beast.ftblib.lib.icon.Icon;
import com.modifiertech.lineage.BaseConst;
import com.modifiertech.lineage.api.PlayerDataSkill;
import com.modifiertech.lineage.base.ConfigHandler;
import com.modifiertech.lineage.client.gui.ftbint.GuiIconsV2;
import com.modifiertech.lineage.commands.CmdHelper;
import com.modifiertech.lineage.event.SkillLevelUpEvent;
import com.modifiertech.lineage.modifier.HealthModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.TextComponentString;

import java.util.ArrayList;
import java.util.List;


/**
 * ClassName: StrongAsBull 技能:身强体壮 <br/>
 * Description: <br/>
 * date: 2020/8/23 18:00<br/>
 *
 * @author Administrator<br />
 * @since JDK 1.8
 */
public class StrongAsBull extends PlayerDataSkill {
    public static final String NAME="强壮如牛";
    @Override
    protected Icon defineSkillIcon() {
        return GuiIconsV2.Strong;
    }

    @Override
    protected String defineSkillType() {
        return BaseConst.PLAYER_ADV_TAG__SKILLS_SPE;
    }

    @Override
    protected String defineSkillSecondType() {
        return BaseConst.PLAYER_ADV_SEC_TAG__SKILLS_STATE;
    }

    @Override
    protected String defineSkillName() {
        return NAME;
    }

    @Override
    protected int defineSkillLevelDependency() {
        return 0;
    }

    @Override
    public String defineSkillDesc() {
        int skillLevel = getSkillLevel();
        return "身强力壮,每级提供额外5点血上限." +
                (skillLevel>0?"\n效果:当前提供 §6§l"+skillLevel*5+" 血量上限.":"") ;
    }

    @Override
    protected double defineSkillRowX() {
        return 2;
    }

    @Override
    protected double defineSkillColumnY() {
        return 1;
    }

    @Override
    protected int defineSkillCoolDown() {
        return -1;
    }

    @Override
    protected double defineSkillManaUse() {
        return 0;
    }

    @Override
    protected List<String> defineSkillDependencyName() {
        return new ArrayList<>();
    }

    @Override
    protected int defineSkillRegion() {
        return 0;
    }

    @Override
    protected int defineUpgradePoint() {
        return 1;
    }

    @Override
    public void onSkillLevelUp(SkillLevelUpEvent.Post even) {
        //每升级一次增加一定血量上限
        revertHealthModifier(even.getEntityPlayer(),getSkillLevel());
//        CmdHelper.execServerSay(new TextComponentString(String.format("鲜血充盈[血量系数>>%s]",HealthModifier.getAllModHealthModifier(even.getEntityPlayer()))));
    }

    public static final void revertHealthModifier(EntityPlayer player,int skillLevel){
        HealthModifier.setModifier(player, HealthModifier.Type.MODIFIER_STRONGASBULL
                ,skillLevel* ConfigHandler.attrAddPerLevel_StrongAsBull);
    }







}
